/*
 * brushlessControlLoop.h
 *
 *  Created: 20251017
 *  Author: Hecate
 */

#ifndef CODE_BRUSHLESS_CONTROL_LOOP_H_
#define CODE_BRUSHLESS_CONTROL_LOOP_H_

#include <stdint.h>

typedef enum
{
    phaseA,
    phaseB,
    phaseC
} brushlessPhase;

typedef struct brushlessControlObject brushlessControlObject;

brushlessControlObject *brushlessControlVelocityOpenLoopInit(float processFre, float phaPwmMax, float tarVel, float tarVelMax, uint8_t polePairs);

void brushlessControlDeinit(brushlessControlObject *obj);
void brushlessControlProcess(brushlessControlObject *obj);

float brushlessControlGetPhasePWMDuty(const brushlessControlObject *obj, brushlessPhase phase);

#endif /* CODE_BRUSHLESS_CONTROL_LOOP_H_ */
